<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script>
    window.targetScaleFactor = 2;
</script>
<script src="../resources/srcset-helper.js"></script>
<script src="http://127.0.0.1:8000/resources/slow-script.pl?delay=100"></script>
</head>
<body>
<script>
    shouldBeFalse("internals.isPreloaded('resources/preload-test.jpg');");
    shouldBeTrue("internals.isPreloaded('resources/base-image2.png');");
    shouldBeFalse("internals.isPreloaded('resources/base-image1.png');");
    shouldBeFalse("internals.isPreloaded('resources/base-image3.png');");
    shouldBeTrue("internals.isPreloaded('resources/image2.png');");
</script>
<div>This test passes if the fallback image (defined in the href attribute) is not preloaded, but the 2x version (defined in imagesrcset) is.</div>
<div>The second link rel=preload is here to make sure isPreloaded is working properly</div>
<link rel="preload" as="image" href="resources/preload-test.jpg" imagesrcset="resources/base-image1.png 1x, resources/base-image3.png 3x, resources/base-image2.png 2x">
<link rel="preload" as="image" href="resources/image2.png">
</body>
</html>

